package com.kafka.producer.controller;

import com.kafka.producer.producer.Producer;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/producer")
public class ProducerController {

    @Resource
    private Producer producer;

    @GetMapping("/msg")
    public String sendMsg() {
        producer.sendMessage("msg1","hello kafka, curTime=" + System.currentTimeMillis());
        return "发送成功";
    }
}
